<?php
class ConfigurationsController extends AppController {

	var $name = 'Configurations';
	var $uses = array();
	var $helpers = array('Html', 'Javascript', 'Form');
	var $layout = 'admin';
	var $components = array('Readini','Auth');
	function index()
	{
		//Read file config
		$filename = WWW_ROOT . 'config/common.ini';
		$this->data = $this->Readini->read($filename);
	}
	
	function save($filename = 'common.ini')
	{
		//Get file name and path
		$file = WWW_ROOT . 'config/'.$filename;
		
		if (!empty($this->data))
		{
			$this->Readini->write($file, $this->data);
			$this->Session->setFlash('Thông tin đã được lưu');
		}
		$this->redirect($this->referer());
	}
	
	function setting_image()
	{
		//Read file config
		$filename = WWW_ROOT . 'config/image.ini';
		$this->data = $this->Readini->read($filename);
	}
	
}
?>